package com.hfzy.ihk.web.userCenter.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hfzy.ihk.facade.userCenter.entity.PrivHasResource;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author wws
 * @since 2018-12-28
 */
public interface PrivHasResourceMapper extends BaseMapper<PrivHasResource> {

    int savePrivHasResource(@Param("privId") Long roleId, @Param("resourceIds") List<Long> resourceIds);


    @Delete("delete from priv_has_resource where priv_id = #{privId}")
    int deletePrivSource(Long privId);

    @Delete("delete from user_has_priv where priv_id = #{privId}")
    int deleteUserHasPrivByPrivId(Long privId);

    @Delete("delete from role_has_priv where priv_id = #{privId}")
    int deleteRoleHasPrivByPrivId(Long privId);

    @Select("select resource_id from priv_has_resource where priv_id = #{id}")
    List<Integer> queryRrsourceByPriId(Long id);
}
